home *** CD-ROM | disk | FTP | other *** search
/ VRML Browsing & Building Cyberspace / VRML - Browsing and Building Cyberspace.iso / examples / fourtnth.wrl < prev    next >
Text File  |  1995-06-14  |  3KB  |  104 lines

  1. #VRML V1.0 ascii
  2.  
  3. # Example fourteen - The Earth gets a specular coloring to reflect the sunlight
  4.  
  5. # Here comes the Sun
  6. # The Separator node groups everything within it together
  7. DEF SOLAR_SYSTEM Separator {
  8.  
  9.     # The material will effect all subsequent nodes
  10.     # The sun is yellow, isn't it?  Additive color means red + green = yellow
  11.     # We're switching to emissive color because the Sun gives off light.
  12.     Material {
  13.         emissiveColor 1 1 0        # The Sun emits lots of yellow light
  14.     }
  15.  
  16.     # We'll make the Sun shine here
  17.     # A PointLight shines equally in all directions, like the Sun does.
  18.     DEF SUNLIGHT PointLight {
  19.         intensity 1        # The Sun is way bright
  20.         color 1 1 0.9   # Sunlight is basically white, even though the Sun is yellow.
  21.     }
  22.  
  23.     # The WWWAnchor node is a group node
  24.     # This means that all objects within it are linked with the anchor's URL
  25.     # We want to link the Sun, so the Sun's Sphere node goes inside of it.
  26.     # Using the description field, we provide context for the user
  27.     # The DEF node attaches the name "SUN" to the WWWAnchor group
  28.     DEF SUN WWWAnchor {
  29.         name "http://www.w3.org/" # The root URL of the World Wide Web
  30.         description "A link from the Sun to W3.ORG" # Decriptive text
  31.  
  32.         # Inside the anchor, because WWWAnchor is a group node
  33.         Sphere {
  34.             radius 10        # Big Sun
  35.         }
  36.     }
  37.  
  38.     # We place the Earth within it's own Separator
  39.     # To keep everything good and isolated
  40.     Separator {
  41.  
  42.         # Let's move things out of the way here
  43.         Transform {
  44.             translation 0 20 20
  45.         }
  46.  
  47.         # Color the Earth blue, and make it absorb light
  48.         # But also make it a reflective, like water
  49.         DEF EARTH_MATERIAL Material {
  50.             diffuseColor 0 0 1 # Big blue marble
  51.             specularColor 0.9 0.9 0.9 # And a little more shiny
  52.             shininess 0.9 # Water is rather shiny
  53.         }
  54.  
  55.         # The WWWAnchor node is a group node
  56.         # This means that all objects within it are linked with the anchor's URL
  57.         # We want to link the Earth, so the Earth's Sphere node goes inside of it.
  58.         # Using the description field, we provide context for the user
  59.         # The DEF node attaches the name "Earth" to the WWWAnchor node
  60.         DEF EARTH WWWAnchor {
  61.             name "http://hyperreal.com/~mpesce/book/examples/second.wrl" # Another world
  62.             description "A link to another world" # Decriptive text
  63.  
  64.             # Finally, create the earth
  65.             Sphere {
  66.                 radius 2    # Little Earth
  67.             }
  68.         }
  69.  
  70.         # The Moon gets its own Separator
  71.         # Because we really do keep everything separate
  72.         Separator {
  73.  
  74.             # The Moon is just outside the Earth
  75.             Transform {
  76.                 translation 4 4 0
  77.             }
  78.  
  79.             # Color the Moon grey, make it absorb light
  80.             # It's a little shiny, but not much
  81.             Material {
  82.                 diffuseColor 0.7 0.7 0.7
  83.                 shininess 0.3
  84.             }
  85.  
  86.             # The WWWAnchor node is a group node
  87.             # This means that all objects within it are linked with the anchor's URL
  88.             # We want to link the Moon, so the Moon's Sphere node goes inside of it.
  89.             # Using the description field, we provide context for the user
  90.             # The DEF node attaches the name "Moon" to the WWWAnchor node
  91.             DEF Moon WWWAnchor {
  92.                 name "http://www.cyborganic.com:80/People/paul/The_new_dogs/pescewrd.au"
  93.                 description "Sounds from a talk about VRML"
  94.  
  95.                 # And now, create the Moon
  96.                 Sphere {
  97.                     radius 1    # Tiny Moon
  98.                 }
  99.             }
  100.         }
  101.     }
  102. }
  103.  
  104.